package cn.gzsxt.music.mapper;

import org.apache.commons.lang3.StringUtils;

import cn.gzsxt.music.query.LableQueryObject;

public class LableProvider {
	
	public String getAllLabelList(LableQueryObject qo) {
		StringBuilder sBuilder = new StringBuilder();
		sBuilder.append("select * from mc_label");
		if (StringUtils.isNotBlank(qo.getKeyword())) {
			sBuilder.append(" where label_name like '%' #{keyword} '%'");
		}
		sBuilder.append(" limit #{beginIndex},#{rows}");
		System.out.println(sBuilder.toString());
		return sBuilder.toString();
	}
	
	public String getAllSongList(LableQueryObject qo) {
		StringBuilder sBuilder = new StringBuilder();
		sBuilder.append("select * from mc_song");
		if (StringUtils.isNotBlank(qo.getKeyword())) {
			sBuilder.append(" where song_name like '%' #{keyword} '%'");
		}
		sBuilder.append(" limit #{beginIndex},#{rows}");
		System.out.println(sBuilder.toString());
		return sBuilder.toString();
	}
	

	public String getAllLabelTotal(LableQueryObject qo) {
		StringBuilder sBuilder = new StringBuilder();
		sBuilder.append("select count(*) from mc_label");
		if (StringUtils.isNotBlank(qo.getKeyword())) {
			sBuilder.append(" where label_name like '%' #{keyword} '%'");
		}
		System.out.println(sBuilder.toString());
		return sBuilder.toString();
	}
	public String getAllSongTotal(LableQueryObject qo) {
		StringBuilder sBuilder = new StringBuilder();
		sBuilder.append("select count(*) from mc_song");
		if (StringUtils.isNotBlank(qo.getKeyword())) {
			sBuilder.append(" where song_name like '%' #{keyword} '%'");
		}
		System.out.println(sBuilder.toString());
		return sBuilder.toString();
	}
	
}
